<?php
	//drupal_set_title($user->getCompleteName());
	$url = $config->getVar('url');
	
	echo
	'<div id="tabs-wrapper" class="clear-block">
		<h2 class="with-tabs">Modifier un utilisateur</h2>
		<ul class="tabs primary">
			<li class="active">
				<a class="active" href="'.$url.'/bdbdec.php?action=addUser">Ajouter un utilisateur</a>
			</li>
			<li>';
			if ($user->getGrade()->getType() == GRADE_TYPE_POWER && $user->isAllowedTo(GRADE_ADD_MEMBER))
				echo '<a href="'.$url.'/bdbdec.php?action=editUserPerm">Modifier un utilisateur</a>';
			else if ($user->getGrade()->getType() == GRADE_TYPE_ADMIN)
				echo '<a href="'.$url.'/bdbdec.php?action=editUserAdmin">Modifier un utilisateur</a>';
			echo '   
			</li>
		</ul>
	</div>

	<form action="./bdbdec.php?action=editUserPerm&amp;id='.$userToChange->getId().'"  accept-charset="UTF-8" method="post" id="edit-user-form">
		<fieldset class="collapsible">
			<legend>Modification d\'un utilisateur par un admin</legend>
			<div>
				<div class="form-item" id="edit-grade-wrapper">
					<label for="edit-grade">Grade: </label>
					<select name="grade" class="form-select" id="edit-grade" >';
					
						$gradeId = $userToChange->getGradeId();
						foreach (grade::getGradesByType(GRADE_TYPE_BASIC) as $grade)
						{
							if ($gradeId != $grade['id'])
								echo '<option value="'.$grade['id'].'">'.$grade['name'].'</option>';
							else
								echo '<option value="'.$grade['id'].'" selected="selected">'.$grade['name'].'</option>';
						}
					echo '
					</select>
				</div>
				<div class="form-item" id="edit-comment-wrapper">
					<label for="edit-comment">Commentaires: </label>
					<textarea cols="45" rows="3" name="comment" id="edit-comment"  class="form-textarea resizable">'.$userToChange->getComment().'</textarea>
				</div>
				<div class="form-item" id="edit-paid-wrapper">
					<label class="option">
						<input type="checkbox" name="paid" id="edit-paid" value="1" '; 
						if ($userToChange->getPaid()) 
							echo 'checked="checked"'; 
						echo ' class="form-checkbox" />
						Paiement de la cotisation effectu&eacute;
					</label>
				</div>
				<div class="form-item" id="edit-deposit-wrapper">
					<label class="option">
						<input type="checkbox" name="deposit" id="edit-deposit" value="1"';
						 if ($userToChange->getDeposit()) echo 'checked="checked"';
						 echo '  class="form-checkbox" /> 
						Paiement de la caution effectu&eacute;
					</label>
				</div>
				<input type="submit" name="op" id="edit-submit" value="Enregistrer"  class="form-submit" />
			</div>
		</fieldset>
	</form>';
?>
